import scala.collection.mutable.ArrayBuffer

object array {
  def main(args: Array[String]): Unit = {
    val arr1 = new Array[Int](10)
    val arr2 = Array(1,2,3,4,5)
    println(arr1.mkString(","))
    arr1(1) = 1
    println(arr1.mkString(","))
    for(i<- arr2){
      println(i)
    }

    var arrayBuffer1 = ArrayBuffer(1,2,3,4,5)
    arrayBuffer1(0)= 0
    arrayBuffer1 += 6
    arrayBuffer1 -= 5
    println(arrayBuffer1.mkString(","))

    //在基础容器arr后面加一个元素
    var arr3 = arr2 :+6
    println(arr3.mkString(","))
    /*元组:类进行模拟，元素的个数:22个
      元组表达当中,第一个元素就是编号1
      元组每个元素直接类型可以不一致，所有可以实现 val tup1 = (1,2,"Hello World")
      如果元素较多，需要使用元组操作，可以使用元组套元组的方式实现叠加
     */
//    val tup1 = (1,2,3,"string")
    val tup1 = (1,2,3,4,5)
    val tup2 = (1,2,3,4,5)
    val tup3 = (1,2,3,4,5)
    val tup4 = (1,2,3,4,5)
    val tup5 = (tup1,tup2,tup3,tup4)
    println(tup1)
    println(tup5)
    println(tup5._1._1)
  }

}
